/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanelBiseccion.java
 *
 * Created on 11-oct-2010, 14:12:47
 */
package interfaz.FuncionPanels.ecuaciones;

import funcion.ManejadorFuncion;
import interfaz.NuMethodApp;
import interfaz.NuMethodConstants;
import java.awt.Color;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.table.DefaultTableModel;
import metodos.Biseccion;
import metodos.ManejadorMetodo;
import org.jdesktop.swingx.JXHyperlink;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
import org.jdesktop.swingx.decorator.SearchPredicate;
import org.jdesktop.swingx.decorator.ShadingColorHighlighter;

/**
 *
 * @author The NuMethod Team
 */
public class PanelBiseccion extends javax.swing.JPanel {

    private String f; //El String que representara la funcion f(X) a ejecutar
    //Variables de la aplicacion
    /**
     * Arreglo de cabeceras de la tabla Biseccion
     */
    String[] names = {"N", "Xi", "Xs", "Xm", "Fxm", "Error"};
    private static ImageIcon errorIcon;
    private static ImageIcon okIcon;
    private static ImageIcon halfSuccessIcon;

    /** Creates new form PanelBiseccion */
    public PanelBiseccion() {


        initComponents();
        initComponents2();
        

    }

   
    


    /**
     * Metodo de utilidad para terminar manualmente la inicializacion de la Interfaz
     */
    private void initComponents2() {
        errorIcon = new ImageIcon(getClass().getResource("/recursos/Icons16/agt_action_fail.png"));
        okIcon = new ImageIcon(getClass().getResource("/recursos/Icons16/agt_action_success.png"));
        halfSuccessIcon = new ImageIcon(getClass().getResource("/recursos/Icons16/admin_icon.png"));
        //        Btm = new BiseccionTableModel();


        //names = {"N", "Xi", "Xs", "Xm", "Fxm", "Error"};
        Object[][] data = new Double[2][6];
        DefaultTableModel tm = new DefaultTableModel(data, names);
        TableBiseccion.setModel(tm);
        ShadingColorHighlighter h =  new ShadingColorHighlighter();
        h.setHighlightPredicate(new HighlightPredicate.DepthHighlightPredicate(tm.getRowCount()));
        TableBiseccion.setHighlighters(h);

        updateFunctions();
    }

    public void updateFunctions (){
        f = NuMethodApp.getF();
        LabelFText.setText(f);
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        SPanelProceso = new javax.swing.JScrollPane();
        TableBiseccion = new org.jdesktop.swingx.JXTable();
        PanelEntrada = new javax.swing.JPanel();
        BotonEjecutar = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        FieldIteraciones = new javax.swing.JTextField();
        FieldError = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        LabelInStatus = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        FieldXInf = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        FieldXSup = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        PanelSalida = new javax.swing.JPanel();
        LabelSalida = new javax.swing.JLabel();
        LabelSalida2 = new javax.swing.JLabel();
        PanelEstado = new javax.swing.JPanel();
        LabelF = new javax.swing.JLabel();
        LabelFText = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();

        setForeground(new java.awt.Color(255, 0, 255));

        SPanelProceso.setBorder(javax.swing.BorderFactory.createTitledBorder("Proceso"));
        SPanelProceso.setToolTipText("Proceso de salida");

        TableBiseccion.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        SPanelProceso.setViewportView(TableBiseccion);

        PanelEntrada.setBorder(javax.swing.BorderFactory.createTitledBorder("Entrada"));

        BotonEjecutar.setText("Ejecutar");
        BotonEjecutar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonEjecutarActionPerformed(evt);
            }
        });

        jPanel3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        FieldIteraciones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FieldIteracionesActionPerformed(evt);
            }
        });

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Icons16/kodo.png"))); // NOI18N
        jLabel5.setText("Iteraciones");

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Icons16/agt_update_critical.png"))); // NOI18N
        jLabel4.setText("Error");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(FieldIteraciones)
                    .addComponent(FieldError, javax.swing.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4))
                .addContainerGap(54, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FieldError, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FieldIteraciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addContainerGap())
        );

        jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Icons16/1uparrow.png"))); // NOI18N
        jLabel2.setText("X Inferior");

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Icons16/1downarrow.png"))); // NOI18N
        jLabel3.setText("X Superior");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(FieldXSup, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(FieldXInf, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addContainerGap(63, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FieldXInf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FieldXSup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addContainerGap())
        );

        javax.swing.GroupLayout PanelEntradaLayout = new javax.swing.GroupLayout(PanelEntrada);
        PanelEntrada.setLayout(PanelEntradaLayout);
        PanelEntradaLayout.setHorizontalGroup(
            PanelEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelEntradaLayout.createSequentialGroup()
                .addGroup(PanelEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(6, 6, 6)
                .addGroup(PanelEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(LabelInStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotonEjecutar, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        PanelEntradaLayout.setVerticalGroup(
            PanelEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelEntradaLayout.createSequentialGroup()
                .addGroup(PanelEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelEntradaLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(LabelInStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotonEjecutar, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jLabel1.setText("Bisección");

        PanelSalida.setBorder(javax.swing.BorderFactory.createTitledBorder("Salida"));

        javax.swing.GroupLayout PanelSalidaLayout = new javax.swing.GroupLayout(PanelSalida);
        PanelSalida.setLayout(PanelSalidaLayout);
        PanelSalidaLayout.setHorizontalGroup(
            PanelSalidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelSalidaLayout.createSequentialGroup()
                .addGroup(PanelSalidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(LabelSalida)
                    .addGroup(PanelSalidaLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(LabelSalida2)))
                .addContainerGap(594, Short.MAX_VALUE))
        );
        PanelSalidaLayout.setVerticalGroup(
            PanelSalidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelSalidaLayout.createSequentialGroup()
                .addComponent(LabelSalida)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
                .addComponent(LabelSalida2)
                .addContainerGap())
        );

        PanelEstado.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        LabelF.setText("f(x) = ");

        javax.swing.GroupLayout PanelEstadoLayout = new javax.swing.GroupLayout(PanelEstado);
        PanelEstado.setLayout(PanelEstadoLayout);
        PanelEstadoLayout.setHorizontalGroup(
            PanelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelEstadoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(LabelF)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(LabelFText)
                .addContainerGap(519, Short.MAX_VALUE))
        );
        PanelEstadoLayout.setVerticalGroup(
            PanelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelEstadoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelF)
                    .addComponent(LabelFText))
                .addContainerGap(26, Short.MAX_VALUE))
        );

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/help.png"))); // NOI18N
        jButton1.setToolTipText("Ayuda");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(PanelEntrada, javax.swing.GroupLayout.Alignment.LEADING, 0, 630, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(PanelSalida, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(SPanelProceso, javax.swing.GroupLayout.DEFAULT_SIZE, 620, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(10, 10, 10)
                                .addComponent(PanelEstado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(21, 21, 21))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(PanelEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addComponent(PanelEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(SPanelProceso, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(PanelSalida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(12, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void FieldIteracionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FieldIteracionesActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_FieldIteracionesActionPerformed

    private void reBuildBiseccionTableModel(ArrayList<Integer> Iters,
            ArrayList<Double> Xi,
            ArrayList<Double> Xs,
            ArrayList<Double> Xm,
            ArrayList<Double> Fxm,
            ArrayList<Double> Errors) {
        int n = Xm.size();
        Double[][] data = new Double[n][6];
        for (int i = 0; i < n; i++) {
            data[i][0] = Iters.get(i).doubleValue();
            data[i][1] = Xi.get(i);
            data[i][2] = Xs.get(i);
            data[i][3] = Xm.get(i);
            data[i][4] = Fxm.get(i);
            data[i][5] = Errors.get(i);
        }

        //Btm.setData(data);
        //Btm.fireTableDataChanged();

        DefaultTableModel tm = new DefaultTableModel(data, names);
        TableBiseccion.setModel(tm);
        tm.fireTableDataChanged();





    }

    private void BotonEjecutarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonEjecutarActionPerformed
        int Iter = 0;
        double Xi = 0;
        double Xs = 0;
        double Error = 0;

        int resultStatus = 0;
        if (FieldXInf.getText() != null) {
            if (FieldXSup.getText() != null) {
                if (FieldError.getText() != null) {
                    if (FieldIteraciones.getText() != null) {
                        // <editor-fold defaultstate="collapsed" desc="Obtener los datos desde la interfaz">
///--------
                        try {
                            Xi = Double.parseDouble(FieldXInf.getText());
                        } catch (NumberFormatException e) {
                            LabelInStatus.setText("Imposible obtener el numero en el campo Xinferior");
                            return;
                        }
                        ///--------
                        try {
                            Xs = Double.parseDouble(FieldXSup.getText());
                        } catch (NumberFormatException e) {
                            LabelInStatus.setText("Imposible obtener el numero en el campo Xsuperior");
                            return;
                        }
                        ///--------
                        try {
                            Error = Double.parseDouble(FieldError.getText());
                        } catch (NumberFormatException e) {
                            LabelInStatus.setText("Imposible obtener el numero en el campo Error");
                            return;
                        }
                        ///--------
                        try {
                            Iter = Integer.parseInt(FieldIteraciones.getText());
                        } catch (NumberFormatException e) {
                            LabelInStatus.setText("Imposible parsear el numero en el campo Iteraciones");
                            return; //Orden de salida externa
                        }// </editor-fold>
                        // <editor-fold defaultstate="collapsed" desc="Ejecutar el metodo">
//Obtenidos y parseados todos los valores, a trabajar
                        ManejadorFuncion.getInstance().addFuncion("f", "x", f);
                        Biseccion.solucionar(Xi, Xs, Iter, Error);
                        reBuildBiseccionTableModel(
                                Biseccion.Iters,
                                Biseccion.Xi,
                                Biseccion.Xs,
                                Biseccion.Xm,
                                Biseccion.Fxn,
                                Biseccion.Errors);// </editor-fold>
                        // <editor-fold defaultstate="collapsed" desc="Mostrar los resultados">
                        //Se termino el metodo, debemos verificar los resultados. e imprimir
                        resultStatus = Biseccion.getLatestStatus();
                        switch (resultStatus) {
                            case (NuMethodConstants.IS_ROOT): {
                                LabelSalida.setText("Se logro un resultado sin errores");
                                LabelSalida.setForeground(Color.GREEN);
                                LabelSalida.setIcon(okIcon);
                                LabelSalida2.setText("El resultado es: " + Biseccion.Xm.get(Biseccion.Xm.size() - 1));

                                break;
                            }
                            case (NuMethodConstants.IS_ROOT_PLUS_ERROR): {
                                LabelSalida.setText("Se logro un resultado con error");
                                LabelSalida.setForeground(Color.ORANGE);
                                LabelSalida.setIcon(halfSuccessIcon);
                                LabelSalida2.setText(
                                        "El resultado es: " + Biseccion.Xm.get(Biseccion.Xm.size() - 1)
                                        + " + un error de: "
                                        + Biseccion.Errors.get(Biseccion.Errors.size() - 1));
                                break;
                            }
                            case (NuMethodConstants.IS_ERROR): {
                                LabelSalida.setText("No fue posible encontrar un resultado con las iteraciones pedidas. devolviendo los ultimos status");
                                LabelSalida.setForeground(Color.red);
                                LabelSalida.setIcon(errorIcon);
                                LabelSalida2.setText(
                                        "Ultimo valor obtenido: " + Biseccion.Xm.get(Biseccion.Xm.size() - 1)
                                        + " + un error de: "
                                        + Biseccion.Errors.get(Biseccion.Errors.size() - 1)
                                        + " con un total de: " + Biseccion.Iters.get(Biseccion.Iters.size() - 1) + " Iteraciones");
                                break;
                            }
                        }// </editor-fold>
                        //Se obtuvieron los datos, ahora podemos vaciar los arreglos temporales
                        Biseccion.flushTempArrays();

                    }//Fin Cuarto campo
                    else {
                        LabelInStatus.setText("Por favor colocar un valor en el campo Iteraciones");
                    }
                }//Fin tercer campo
                else {
                    LabelInStatus.setText("Por favor colocar un valor en el campo Error");
                }
            }//Fin Segundo Campo
            else {
                LabelInStatus.setText("Por favor colocar un valor en el campo Xsuperior");
            }
        }//Fin Primer campo
        else {
            LabelInStatus.setText("Por favor colocar un valor en el campo Xinferior");
        }
    }//GEN-LAST:event_BotonEjecutarActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        NuMethodApp.helpLauncher("Biseccion.html");
    }//GEN-LAST:event_jButton1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonEjecutar;
    private javax.swing.JTextField FieldError;
    private javax.swing.JTextField FieldIteraciones;
    private javax.swing.JTextField FieldXInf;
    private javax.swing.JTextField FieldXSup;
    private javax.swing.JLabel LabelF;
    private javax.swing.JLabel LabelFText;
    private javax.swing.JLabel LabelInStatus;
    private javax.swing.JLabel LabelSalida;
    private javax.swing.JLabel LabelSalida2;
    private javax.swing.JPanel PanelEntrada;
    private javax.swing.JPanel PanelEstado;
    private javax.swing.JPanel PanelSalida;
    private javax.swing.JScrollPane SPanelProceso;
    public org.jdesktop.swingx.JXTable TableBiseccion;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    // End of variables declaration//GEN-END:variables
}
